package com.lcz.lcz_blog.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lcz.lcz_blog.entity.Blog;
import com.lcz.lcz_blog.mapper.BlogMapper;
import com.lcz.lcz_blog.service.IBlogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 刘传政
 * @since 2022-01-17
 */
@Service
public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IBlogService {
    @Autowired
    BlogMapper blogMapper;
    @Override
    public Blog queryBlogById(int id) {
        Blog blog = blogMapper.queryBlogById(id);
        return blog;
    }

    @Override
    public List<Blog> queryAll() {
        return blogMapper.queryAll();
    }

    @Override
    public IPage<Blog> queryPage(Page<Blog> page, QueryWrapper<Blog> queryWrapper) {
        return blogMapper.queryPage(page,queryWrapper);
    }

    @Override
    public IPage<Blog> queryCollectPage(Page<Blog> page, QueryWrapper<Blog> queryWrapper, int userId) {
        return blogMapper.queryCollectPage(page,queryWrapper,userId);
    }
}
